home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / comm / mebbs / grabmail.lha / GrabMail.rexx < prev   
OS/2 REXX Batch file  |  1994-11-30  |  3KB  |  21 lines

  1. /* Grab Your Mail - Another Silly Arexx Door by Larry Cloud M3001 */
  2. signal on ERROR;signal on syntax;signal on ioerr;options results;parse arg LineNumber;DoorName="Grab Your Mail";if(~show('l',"mebbsarexx.library")) then do;if(~addlib("mebbsarexx.library",0,-30,0)) then do;say "Could not open library";exit 10;end;end;call GetVar DoorName,LineNumber,1;username=upper(result);uzname=space(username,1,"_");call chcar;i=0;string=d2c(12);call output;call open(file,"MEBBSNET:CONFIGFILES/GRABMAIL.CFG",'r');do until eof(file);i=i+1;name.i=upper(readln(file));adr.i=readln(file);end;call close(file);f=0;i=i-1;do loop=1 to i;if name.loop=username then f=loop;end;if f=0 then signal getout;quote=d2c(34);string="list out: nodates nohead quick files sub "||quote||adr.f||quote||" to "||quote||"t:grabyourmail.txt"||quote;address command string;do i=1 to 1000;end;call chcar;i=0;call open(file,"t:grabyourmail.txt",'r');do until eof(file);i=i+1;data.i=readln(file);end;call close(file);i=i-1;if data.1="" then do;string="You have no mail/files waiting in OUT:"
  3. call output;signal getout;end;string="You have mail/files waiting in OUT:, would you like to grab them now? (Y/n)";call output;string=">";call getkey;if upper(hot)="N" then signal getout;string="Yes";call output;string="";call output;comment.1="Thanks, "||username||", for picking up your mail.";comment.2="This saves you having to poll for them since you were connected here anyway.";comment.3="Larry Cloud sure is a nice guy for writing such a program, isn't he?";call open(file,"T:"||uzname||".README",'w');do ct=1 to 3;call writeln(file,comment.ct);end;call close(file);datastring="lha a t:yourmail.lha t:"||uzname||".README";do loop=1 to i;datastring=datastring||" OUT:"||data.loop;end;ct=0;tic.0="";call chcar;do loop=1 to i;if right(data.loop,4)=".FLO" then do;call open(file,"OUT:"||data.loop,'r');do until eof(file);x=readln(file);cl=index(x,":");if cl=0 then x="OUT:"||x;datastring=datastring||" "||x;if right(x,4)=".tic" then do;ct=ct+1;tic.ct=x;end;end;call close(file);end;end
  4. string="LHAing up your outgoing mail/files, please stand by.";call output;address command datastring;string="Ready to send your mail/files.";call output;fylz="t:yourmail.lha";call sendbinfile doorname,linenumber,fylz;success=upper(result);call chcar;if success~="DONE" then do;string="Aborted.  Nothing deleted.";call output;do i=1 to 5000;end;signal getout;end;string="delete out:"||adr.f||"#? quiet";address command string;if ct ~=0 then do;do i=1 to ct;address command "delete out:"||tic.i;end;end;string="All of your outgoing mail/fileticks have been cleared from OUT:";call output;do i=1 to 4000;end;address command "delete t:#?yourmail#? quiet";address command "delete t:"||uzname||".readme quiet";signal getout
  5. OUTPUT:
  6. call chcar;call message doorname,linenumber,string,1
  7. return
  8. GETOUT:
  9. string="";call output;address command "delete t:#?yourmail#? quiet";call Exit_Door DoorName,LineNumber
  10. exit 0
  11. SYNTAX:
  12. IOERR:
  13. ERROR:
  14. r=rc;s=sigl;say"Error "||r||" "||errortext(r)||" line "||s;call Exit_Door DoorName,LineNumber
  15. exit 10
  16. chcar:
  17. call cdetect doorname,linenumber;car=upper(result);if car="CARRIER OK." then return
  18. signal error
  19. GETKEY:
  20. call hotkey doorname,linenumber,string;hot=result;return
  21.